home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / cups.preinst < prev    next >
Encoding:
Text File  |  2012-12-29  |  2.8 KB  |  92 lines

  1. #! /bin/sh
  2. # preinst script for cups
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <new-preinst> `install'
  10. #        * <new-preinst> `install' <old-version>
  11. #        * <new-preinst> `upgrade' <old-version>
  12. #        * <old-preinst> `abort-upgrade' <new-version>
  13.  
  14. # Remove a no-longer used conffile (from http://wiki.debian.org/DpkgConffileHandling)
  15. rm_conffile() {
  16.         PKGNAME="$1"
  17.         CONFFILE="$2"
  18.         if [ -e "$CONFFILE" ]; then
  19.                 md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  20.                 old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\'^ $CONFFILE[[:space:]]'{s/ obsolete$//;s/.* //p}\"`"
  21.                 if [ "$md5sum" != "$old_md5sum" ]; then
  22.                         echo "Obsolete conffile $CONFFILE has been modified by you."
  23.                         echo "Saving as $CONFFILE.dpkg-bak ..."
  24.                         mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  25.                 else
  26.                         echo "Removing obsolete conffile $CONFFILE ..."
  27.                         rm -f "$CONFFILE"
  28.                 fi
  29.         fi
  30. }
  31.  
  32. case "$1" in
  33.     install|upgrade)
  34.     if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
  35.         echo -n "Moving printer definition files..."
  36.         mkdir -p /etc/cups/ppd || true
  37.         if [ `ls /var/lib/cups/ppd | wc -l` -ne "     0" ]; then
  38.         cp -a /var/lib/cups/ppd/* /etc/cups/ppd
  39.         fi
  40.         rm -rf /var/lib/cups/ppd
  41.         echo "done."
  42.     fi
  43.  
  44.     if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
  45.         rmdir /var/lib/cups/logs || true
  46.     fi
  47.  
  48.     # Remove dangling pdftops.conf symlink, which is obsolete anyway
  49.     if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
  50.         rm -f /etc/cups/pdftops.conf
  51.     fi
  52.  
  53.     # does not need d-bus configuration, only sends signals
  54.     if dpkg --compare-versions "$2" lt-nl '1.3.9-16'; then
  55.             rm -f /etc/dbus-1/system.d/cups.conf
  56.     fi
  57.  
  58.     # Obsolete symlinks, and they wreak havoc now
  59.     if dpkg --compare-versions "$2" lt-nl '1.4.0-6'; then
  60.         rm -f /usr/share/ppd/1-local-admin /usr/share/ppd/2-third-party
  61.     fi
  62.  
  63.         # On Ubuntu, replace the obsolete init script (replaced by an upstart job)
  64.     if [ "`lsb_release -is 2>/dev/null`" = "Ubuntu" ] && [ ! -L /etc/init.d/cups ] && dpkg --compare-versions "$2" le-nl "1.4.4-6"; then
  65.         rm_conffile cups /etc/init.d/cups
  66.         update-rc.d cups remove
  67.     fi
  68.  
  69.         if dpkg --compare-versions "$2" le "1.4.4-7+squeeze2~" && [ -e /etc/cups/cupsd.conf ]; then
  70.             # Move cupsd.conf away as it becomes a non-conffile
  71.             mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.conffile-bak
  72.         fi
  73.     ;;
  74.  
  75.     abort-upgrade)
  76.     ;;
  77.  
  78.     *)
  79.         echo "preinst called with unknown argument \`$1'" >&2
  80.         exit 0
  81.     ;;
  82. esac
  83.  
  84. # dh_installdeb will replace this with shell code automatically
  85. # generated by other debhelper scripts.
  86.  
  87.  
  88.  
  89. exit 0
  90.  
  91.  
  92.